package com.example.apidocserver.domain.space.event.impl;

import com.example.apidocserver.domain.space.entity.Space;
import com.example.apidocserver.domain.space.event.SpaceDomainService;
import com.example.apidocserver.domain.space.service.SpaceService;
import com.example.apidocserver.infrastructure.util.result.ParamException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * 工作空间领域业务
 *
 * @author xyqlg
 */
@Service
@Slf4j
public class SpaceDomainServiceImpl implements SpaceDomainService {
    @Resource
    private SpaceService spaceService;

    @Override
    public void checkById(Integer spaceId) {
        Space space = spaceService.queryById(spaceId);
        if (Objects.isNull(space)) {
            throw new ParamException("工作空间已不存在。");
        }
    }
}
